import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LIUYANJIAO
 * Date: 2024-08-01
 * Time: 12:14
 */
public class Main {
    public static int fib(int N){
        return N<2? N:fib(N-1)+fib(N-2);
    }
    public static long factorial(int N){
        return N>=2? factorial(N-1)*N:N;
    }

    public static void main(String[] args) {
        System.out.println(factorial(3));
    }
    public static int binarySearch(int pos,int[]arr){
        int left=0;
        int right=arr.length-1;
        while(left<=right){
            if(pos<arr[(left+right)/2]){
                right=(left+right)/2-1;
            } else if (pos>arr[(left+right)/2]) {
                left=(left+right)/2+1;
            }else return (left+right)/2;
        }return -1;
    }
    public static void bubbleSort(int[]arr){
        int tmp=0;
        for (int i = 0; i < arr.length-1; i++) {
            for(int j=0;j<arr.length-1-i;j++){
                if(arr[j]>arr[j+1]){
                    tmp=arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=tmp;
                }
            }
        }
    }
    public static int find(int pos,int[] arr){
        //数组中搜索数据
        for (int i = 0; i < arr.length; i++) {
            if(arr[i]==pos) return i;
        }
        return -1;
    }
    public static void main1(String[] args) {
        int[]arr={1,2,3,4,5,6,7};
        System.out.println(binarySearch(5,arr));
    }
}